package com.atguigu.search.controller;


import com.atguigu.common.to.es.SkuHasStock;
import com.atguigu.common.to.es.SpuUpTo;
import com.atguigu.search.service.SearchSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
public class SearchSaveController {


    @Autowired
    private SearchSaveService searchSaveService;
    @PostMapping("/search/save")
    public void searchSave(@RequestBody List<SpuUpTo> spuUpTos){
        try {
            searchSaveService.searchSave(spuUpTos);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
